Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class com.sun.java.swing.event.TreeModelEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.sun.java.swing.event.TreeModelEvent

public class TreeModelEvent
extends java.util.EventObject
Encapsulates information describing changes to a tree model, and used to notify tree model listeners of the change.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
Serialized Form

Field Summary
int[] childIndices
          Indices identifying the position of where the children were.
java.lang.Object[] children
          Children that have been removed.
TreePath path
          Path to the parent of the nodes that have changed.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
TreeModelEvent(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
          Used to create an event when nodes have been changed, inserted, or removed; identifying the path to the parent of the modified items as an array of Objects.
TreeModelEvent(java.lang.Object source, TreePath path, int[] childIndices, java.lang.Object[] children)
          Used to create an event when nodes have been removed, identifying the path to the parent of the removed items as a TreePath object.
TreeModelEvent(java.lang.Object source, java.lang.Object[] path)
          Used to create an event when nodes have been inserted, a node has changed, or the node structure has changed in some way, identifying the path to the change as an array of Objects.
TreeModelEvent(java.lang.Object source, TreePath path)
          Used to create an event when nodes have been inserted, a node has changed, or the node structure has changed in some way, identifying the path to the change as a TreePath object.
 
Method Summary
int[] getChildIndices()
          Returns the values of the child indexes.
java.lang.Object[] getChildren()
          Returns the objects that are children of the node identified by getPath at the locations specified by getChildIndices.
java.lang.Object[] getPath()
          Convenience method to get the array of objects from the TreePath instance that this event wraps.
TreePath getTreePath()
          Returns the TreePath object identifying the changed node.
java.lang.String toString()
          Returns a string that displays and identifies this object's properties.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

path

protected TreePath path
Path to the parent of the nodes that have changed.

childIndices

protected int[] childIndices
Indices identifying the position of where the children were.

children

protected java.lang.Object[] children
Children that have been removed.
Constructor Detail

TreeModelEvent

public TreeModelEvent(java.lang.Object source,
                      java.lang.Object[] path,
                      int[] childIndices,
                      java.lang.Object[] children)
Used to create an event when nodes have been changed, inserted, or removed; identifying the path to the parent of the modified items as an array of Objects. All of the modified objects are siblings which are direct descendents (not grandchildren) of the specified parent. ----TO BE VERIFIED---(eta) ---TO BE DETERMINED: INDICES SPECIFIED AS "1,3,5" for a 5-child list or as "1,2,3" ??
Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - an array of Object identifying the path to the parent of the removed item(s), where the first element of the array is the Object stored at the root node and the last element is the Object stored at the parent node
childIndices - an array of int that specifies the index values of the removed items
children - an array of Object the orphaned child objects

TreeModelEvent

public TreeModelEvent(java.lang.Object source,
                      TreePath path,
                      int[] childIndices,
                      java.lang.Object[] children)
Used to create an event when nodes have been removed, identifying the path to the parent of the removed items as a TreePath object. All of the removed objects must have been direct descendents (not grandchildren) of the specified parent. ----TO BE VERIFIED---(eta)
Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - a TreePath object that identifies the path to the parent of the removed item(s). In the DefaultTreeModel, this object contains an array of user-data objects, but a subclass of TreePath could use some totally different mechanism -- for example, a node ID number
childIndices - an array of int that specifies the index values of the removed items
children - an array of Object the orphaned child objects
See Also:
TreeModelEvent(Object,Object[],int[],Object[]), TreePath

TreeModelEvent

public TreeModelEvent(java.lang.Object source,
                      java.lang.Object[] path)
Used to create an event when nodes have been inserted, a node has changed, or the node structure has changed in some way, identifying the path to the change as an array of Objects. ----TO BE VERIFIED---(eta)

When the object data at a node has changed, the path points to the changed item. When nodes have been inserted or the tree's structure has changed, the path points to the parent of the changes. A "structure change" might involve nodes swapping position, for example, or it might encapsulate multiple inserts and deletes (without identifying which nodes have been removed).

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - an array of Object identifying the path to the change, where the first element of the array is the object stored at the root node and the last element is the object stored at the changed node

TreeModelEvent

public TreeModelEvent(java.lang.Object source,
                      TreePath path)
Used to create an event when nodes have been inserted, a node has changed, or the node structure has changed in some way, identifying the path to the change as a TreePath object. ----TO BE VERIFIED---(eta)

When the object data at a node has changed, the path points to the changed item. When nodes have been inserted or the tree's structure has changed, the path points to the parent of the changes. A "structure change" might involve nodes swapping position, for example, or it might encapsulate multiple inserts and deletes (without identifying which nodes have been removed).

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - a TreePath object that identifies the path to the change. In the DefaultTreeModel, this object contains an array of user-data objects, but a subclass of TreePath could use some totally different mechanism -- for example, a node ID number
See Also:
TreeModelEvent(Object,Object[]), TreePath
Method Detail

getTreePath

public TreePath getTreePath()
Returns the TreePath object identifying the changed node. Use getLastPathComponent on that object to get the data stored at that node.
Returns:
the TreePath object identifying the changed node
See Also:
getLastPathComponent

getPath

public java.lang.Object[] getPath()
Convenience method to get the array of objects from the TreePath instance that this event wraps.
Returns:
an array of Objects, where the first Object is the one stored at the root and the last object is the one stored at the node identified by the path

getChildren

public java.lang.Object[] getChildren()
Returns the objects that are children of the node identified by getPath at the locations specified by getChildIndices. If this is a removal event the returned objects are no longer children of the parent node.
Returns:
an array of Object containing the children specified by the event
See Also:
getPath, getChildIndices

getChildIndices

public int[] getChildIndices()
Returns the values of the child indexes. If this is a removal event the indexes point to locations in the initial list where items were removed. If it is an insert, the indices point to locations in the final list where the items were added. For node changes, the indices point to the locations of the modified nodes.
Returns:
an array of int containing index locations for the children specified by the event

toString

public java.lang.String toString()
Returns a string that displays and identifies this object's properties.
Returns:
a String representation of this object
Overrides:
toString in class java.util.EventObject

Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug or feature
Submit comments/suggestions about javadoc
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.